home *** CD-ROM | disk | FTP | other *** search
- unit Ffltlbox;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls;
-
- type
- TFileFilterListBox = class(TListBox)
- private
- { Private declarations }
- FTheMask : String;
- FOnShowFileList : TNotifyevent;
- protected
- { Protected declarations }
- public
- { Public declarations }
- procedure ShowFileList;
- published
- { Published declarations }
- Property TheMask : String read FTheMask write FTheMask;
- property OnShowFileList : TNotifyEvent read FOnShowFileList write
- FOnShowFileList;
- end;
-
- procedure Register;
-
- implementation
-
- procedure TFileFilterListBox.ShowFileList;
- var Finished : Boolean; { Loop flag }
- TheSR : TSearchRec; { Searchrecord for FF/FN }
- TheResult : Integer; { return variable }
- begin
- if Assigned( FOnShowFileList ) then OnShowFileList( Self );
- if TheMask = '' then exit;
- Finished := false;
- { Make needed call to FindFirst and discard '.' }
- TheResult := FindFirst( TheMask , faAnyFile , TheSR );
- while not Finished do
- begin
- { Loop through file again, this time getting only archive files }
- TheResult := FindNext( TheSR );
- { Result of -1 indicates no more files }
- if TheResult < 0 then Finished := true else
- begin
- Items.Add( TheSR.Name );
- end;
- end;
- Show;
- end;
-
- procedure Register;
- begin
- RegisterComponents('Widgets', [TFileFilterListBox]);
- end;
-
- end.
-